Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add team_themes table #2602

Merged
merged 5 commits into from
Jan 2, 2024
Merged

feat: Add team_themes table #2602

merged 5 commits into from
Jan 2, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Dec 22, 2023

What does this PR do?

  • Moves team.theme JSONB to a new team_themes table
  • Migrates data from column to table
  • Updates frontend queries and types

Relies on theopensystemslab/planx-core#242

Copy link

github-actions bot commented Dec 22, 2023

🤖 Hasura Change Summary compared a subset of table metadata including permissions:

Tracked Tables (1)

  • public.team_themes permissions:

    insert select update delete
    api
    platformAdmin
    public
    teamEditor
    32 added column permissions
    insert select update
    api ➕ favicon
    ➕ id
    ➕ logo
    ➕ primary_colour
    ➕ secondary_colour
    ➕ team_id
    platformAdmin ➕ favicon
    ➕ logo
    ➕ primary_colour
    ➕ secondary_colour
    public
    teamEditor ➕ favicon
    ➕ logo
    ➕ primary_colour
    ➕ secondary_colour

Updated Tables (1)

  • public.teams permissions:

    insert select update delete
    api /
    platformAdmin / / /
    public /
    teamEditor /
    6 removed column permissions
    insert select update
    api ➖ theme
    platformAdmin ➖ theme ➖ theme
    public
    teamEditor

Copy link

github-actions bot commented Dec 22, 2023

Removed vultr server and associated DNS entries

FROM
teams;

ALTER TABLE "public"."teams" DROP COLUMN "theme" CASCADE;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migrating and then dropping the column will work on staging and prod, but on the initial migration on Pizza and locally it won't do anything as the data sync happens after Hasura migrations run.

I tested this locally without dropping the column. If preferred, I can split this into two steps / two PRs.

@@ -3,6 +3,7 @@ CREATE TEMPORARY TABLE sync_teams (
id integer,
name text,
slug text,
-- TODO: Drop this and fetch from team_themes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO intentionally left here, we'll need to update sync scripts only once this new table is in prod.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DafyddLlyr

I think this might be related but I was having issues building main since coming back from the holidays.

I was seeing:

psql:write/teams.sql:18: ERROR:  invalid input syntax for type json
DETAIL:  Expected end of input, but found "-11".

Which was resolved by commenting out theme jsonb,

"id" serial NOT NULL,
"team_id" integer NOT NULL,
"primary_colour" text NOT NULL DEFAULT '#0010A4',
"secondary_colour" text,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check with @ianjon3s in the new year how we should handle defaults for this column.

@DafyddLlyr DafyddLlyr force-pushed the dp/team-themes-table branch from 6bfa867 to fc3aa02 Compare January 2, 2024 08:37
@DafyddLlyr DafyddLlyr merged commit 8db9e42 into main Jan 2, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/team-themes-table branch January 2, 2024 10:08
DafyddLlyr added a commit to theopensystemslab/planx-core that referenced this pull request Jan 2, 2024
DafyddLlyr added a commit to theopensystemslab/planx-core that referenced this pull request Jan 3, 2024
This updates `planx-core` types to match new table added in
theopensystemslab/planx-new#2602

Implemented in theopensystemslab/planx-new#2628
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants